Skip to content

Add --reverse-fields option to show register fields in LSB to MSB order.#60

Merged
amykyta3 merged 3 commits into
SystemRDL:mainfrom
DavidAntliff:59-reverse-fields
Jan 14, 2026
Merged

Add --reverse-fields option to show register fields in LSB to MSB order.#60
amykyta3 merged 3 commits into
SystemRDL:mainfrom
DavidAntliff:59-reverse-fields

Conversation

@DavidAntliff
Copy link
Copy Markdown
Contributor

Please consider merging this addition.

This PR adds a --reverse-fields option, which reverses the table order of all register fields.

This puts the field at the lowest position first, and the next after, and so on.

Reserved fields before/after are correctly generated too.

Please see #59 for background.

@DavidAntliff
Copy link
Copy Markdown
Contributor Author

DavidAntliff commented Jan 14, 2026

Without the new option:

image

With the new --reverse-fields option:

image

Note that the Field Description order is also influenced by this option, and changes the order as you would expect.

@amykyta3
Copy link
Copy Markdown
Member

In your screenshot, the reserved space is shown as [low:high] which is inconsistent with the rest. Is that perhaps a typo? It looks odd.

@DavidAntliff
Copy link
Copy Markdown
Contributor Author

In your screenshot, the reserved space is shown as [low:high] which is inconsistent with the rest. Is that perhaps a typo? It looks odd.

Yep, sorry, I missed that - will fix now.

@amykyta3
Copy link
Copy Markdown
Member

amykyta3 commented Jan 14, 2026

Also, in the __peakrdl__.py descriptor, can you add a similar option to the cfg_schema to allow users to override it via peakrdl.toml?

@DavidAntliff
Copy link
Copy Markdown
Contributor Author

image

Also, in the peakrdl.py descriptor, can you add a similar option to the cfg_schema to allow users to override it via peakrdl.toml?

Sure - will do

@DavidAntliff
Copy link
Copy Markdown
Contributor Author

@amykyta3 is there an "override convention" in PeakRDL that I should be aware of?

Generally, a command-line option usually overrides a config file option, giving a priority of:

command-line option > config option > default

PeakRDL-html doesn't seem to have any config/command-line options that overlap, but maybe there are other plugins that already set a precedent?

@DavidAntliff
Copy link
Copy Markdown
Contributor Author

DavidAntliff commented Jan 14, 2026

@amykyta3 Please see if you're happy with the committed logic:

  • default is False
  • if config TOML sets it to be True, and no command-line option is present, it is enabled
  • if config TOML sets it to be False, and the command-line option sets it, it is enabled
  • if config TOML doesn't set it at all, the command-line option enables it, if present

@amykyta3
Copy link
Copy Markdown
Member

Looks good! I just committed a slight simplification to the reverse_fields logic. Same thing, just more direct.

@amykyta3 amykyta3 merged commit 01dd541 into SystemRDL:main Jan 14, 2026
3 checks passed
@DavidAntliff
Copy link
Copy Markdown
Contributor Author

DavidAntliff commented Jan 14, 2026

Great, thank you, we'll be using this new option immediately :) (well, once released)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants